/*
 * Copyright (C) 2012 The Aliyunos Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.way.filemanager.util;

import android.content.Context;
import android.widget.Toast;

/**
 * A helper class with useful methods for deal with dialogs.
 */
public final class DialogHelper {

    /**
     * Method that creates and display a toast dialog.
     *
     * @param context
     *            The context to use.
     * @param msg
     *            The message to display.
     * @param duration
     *            How long to display the message.
     */
    public static void showToast(Context context, String msg, int duration) {
        Toast.makeText(context, msg, duration).show();
    }

    /**
     * Method that creates and display a toast dialog.
     *
     * @param context
     *            The context to use.
     * @param msgResourceId
     *            The resource id of the string resource to use.
     * @param duration
     *            How long to display the message.
     */
    public static void showToast(Context context, int msgResourceId,
            int duration) {
        showToast(context, context.getString(msgResourceId), duration);
    }

}
